<?php 
include_once ('./global.php');
$show = $_GET['show'];
$index = $_GET['index'];
if(!$index){
	$index = 0;
}
$matchlists = array('4579','4579','4579');
$colors = array('#01264a','#01264a','#01264a','#01264a','#01264a','#01264a');
//$mt_id = 4164;

$ingroups = selGroupName($mt_id);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">

<link href="./mobile/css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./mobile/js/jquery-1.8.3.min.js"></script>

<title><?php echo $match_cn_name?>-成绩直播-lcd</title>


   
<style>
	
	#sta{
		background-color:rgba(0,0,0,0);
		height:80px;
		color:#fff;
	}
	#content_score {
		min-height: 760px;
		margin-top:135px;
		width:1880px;
		margin-left:auto;
		margin-right:auto;
		border-radius:10px;
		background-color:rgba(255,255,255,0.8);
		padding-top:0px;
		overflow:hidden;
		padding-bottom:0;
		z-index:100;
		box-shadow:gray 0px 0px 10px;
	}
	.radius_fillet3 {
		border-radius: 3px;
	}

	.tt_bar {
		height: 30px;
		border-bottom: 1px solid #e3e3e3;
	}
	.score_title2 {
		height: 30px;
		border-bottom: 1px solid #e3e3e3;
		text-indent: 14px;
	}
	.score_back {
		text-align: right;
		padding-right: 14px;
	}
	.bt_back {
		display: inline-block;
		width: 40px;
		height: 18px;
		line-height: 18px;
		cursor: pointer;
		border: 1px solid #363636;
		color: #363636;
		font-size: 12px;
		text-align: center;
	}
	.score_tround {
		height: 30px;
		line-height: 30px;
	}
	.score_tround span {
		color: #363636;
		float: right;
		font-size: 18px;
		height: 26px;
		line-height: 32px;
		margin-right: 15px;
		text-align: center;
		width: 50px;
	}
	.index_news {
		padding: 0 0;
		
	}
	#playoff{
		margin:15px;
		border:solid 1px #a9c6c9;
	}
	
	.SAME{
		background-color:#C60;
		color:white;
		font-size:10px;
		padding:3px;
	}
	
	.WNR{
		background-color:#6C3;
		color:white;
		font-size:10px;
		padding:3px;
	}
	
	.ELM{
		background-color:#C30;
		color:white;
		font-size:10px;
		padding:3px;
	}
	.country{
		color:#ef7ca3;
		}
	.playofftitle{
		background-color:white;
		color:#666;
		font-weight:bold;
		height:30px;
		font-size:15px;
	}
	.playoffhole{
		background-color:#F0F0F0;
		height:30px;
		color:#666;
		font-weight:bold;
		
		}
	.playoffplayer{
		border-bottom:solid 1px #FFF;
		height:30px;
	}
	
	.socringtable{
		border-radius:20px;  border-collapse: collapse;  border-style:hidden;  box-shadow: 0 0 0 1px #d8d8d8; overflow:hidden;
	}
	
	.socringtable td{height:38px;font-size:18px; display:table-cell; vertical-align:middle }
	.socringtable td img{width:30px;height:30px;}
	.leadertoparunder{background-color:#9B3135;color:#fff;width:60px;height:35px;border-radius:10px;}
	.leadertopareven{background-color:#444446;color:#fff;width:60px;height:35px;border-radius:10px;}
	.leadertoparplus{background-color:#1E213C;color:#fff;width:60px;height:35px;border-radius:10px;
</style>
<!--header-->
<style>

.element::-webkit-scrollbar {display:none}
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */

::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}
	#navi_wait {
		height: 35px;
		background-color: #E3E3E3;
	}

	#navi_wait ul li {
		width: 32%;
		display: inline;
		float: left;
		/*line-height:33px;*/

		line-height: 36px;
		list-style-position: inside;
		border-bottom: 1px solid #A5A5A5;
		text-align: center;
	}

	#navi_wait ul li a {
		color: #767676;
		font-size: 19px;
		letter-spacing: 5px;
	}
	
	#body{
		
		position:fixed;
		left:0;
		top:0;
		margin-left:auto;
		margin-right:auto;
		background:url('images/bj.png');
		background-size:cover;
		color:#fff;
		width:1920px;
		height:1080px;
	}
	
	.row{display:flex;flex-direction:row;height:60px;align-items:center;justify-content:center;background-color:#fff;color:#333;width:100%;font-size:16px;}
.leadertitle{ height:60px; font-size:20px; border-bottom:1px solid #333; }
.leadertitle div,.row div{display:flex;flex-direction:row;align-items:center;justify-content:center;text-align:center;height:100%;overflow:hidden;}
.row .w3{width:3%;}
.row .w3-5{width:3.5%;}
.row .w4{width:4%;}
.row .w5{width:5%;}
.row .w6{width:6%;}
.row .w5{width:5%;}
.row .w8{width:8%;}
.row .w10{width:10%;}
.row .w12{width:12%;}
.row .w15{width:15%;}
.row .w20{width:20%;}
.row .w30{width:30%;}
.row .w35{width:35%;}
.row .w50{width:50%;}
.row .w45{width:45%;}
.row .w15{width:15%;}
.row .w100{width:100%;}
.holebyholetitle{height:60px;font-size:20px; border-bottom:1px solid #333;}
.holebyholetitle .hole{display:flex;flex-direction:column;justify-content:center;align-items:center;color:#fff;}
.holebyholetitle .hole .holeno{display:flex;justify-content:center;align-items:center;width:100%;}
.holebyholetitle .hole  .holepar{display:flex;justify-content:center;align-items:center;width:100%;}



.score{ border-bottom:1px solid #333;width:100%;font-size:23px;font-weight:bolder;}
.score .thru{ background-color:#cfcfcf;}
.score .name{display:flex; text-align:left;justify-content:flex-start;overflow:hidden; }
.score .name span{ margin-left:10px; height:100%;white-space:nowrap;overflow-x:scroll; }
.holebyholescore {font-size:23px;}
.holebyholescore .playernametitle{display:flex; text-align:left;justify-content:flex-start;overflow:hidden; }
.holebyholescore .outin{background-color:#cfcfcf;}
.holebyholescore .round{background-color:#f1f1f1;}
.holebyholescore .total{background-color:#cfcfcf;font-weight:bolder;}

.holebyholescore .hole div{width:90%;height:40px;border-radius:2px;}
div::-webkit-scrollbar {display:none}

.holebyholescore .topar,.score .topar{
		width:90%;
		height:90%;
		border-radius:5px;
		margin:auto auto auto auto;
		color:#fff;
		display:flex;
		justify-content:center;
		align-items:center;
		
	}
	.undereven {
		font-weight:bolder;
		background-color:#B7001F; 
		color:#fff;
	}
	.even{
		font-weight:bolder;
		background-color:#53565A;
		color:#fff;
	}
.pluseven {
		font-weight:bolder;
		background-color:#00438A;
		color:#fff;
	}
	
</style></head>
<body id="body">

	


	<div id="content_score" style="height:935px;">
		
		
		
	
		<div id="con2" class="index_news" style="max-height:855px;overflow:hidden; display:flex;flex-direction:row;" >
		    <div id="leftleader" style="width:430px;margin-right:auto;height:855px;" >
				
				
			</div>
			<div id="con_scoring" style="width:1440px;margin-left:auto;">
				<div id="con_scoring_main" style="display:flex;flex-direction:column;">
				
				  <div id="con_scoring_content" style="width:100%;height:855px;overflow:scroll; scrollbar-width: none; 
   -ms-overflow-style: none; ">
				  </div>
				 
				</div>
			</div>
			
			
	  </div>
	  <div id="logoes"  style="width:100%;height:80px;position:relative;">
			<div  class="poppin" style="position:absolute;left:50px;bottom:5px;z-index:9;opacity:0.2; color:#333;font-size:60px;font-weight:900;Transform:rotate(-1deg) " id="button_areaindex">  
				<?php  echo  'ROUND '.$rd_id;?>
			</div>
			<marquee style="position:absolute;left:0;top:0;z-index:10;height:80px;"><img  src="./images/foot.png"></img></marquee>
	</div>
	</div>
	
	<script>
	var matchlists = [<?php 
$matchsstr = '';
foreach ($matchlists as $c=>$v){
	$matchsstr  .= ("'".$v."',");
} 
if($matchsstr){
	$matchsstr = substr($matchsstr,0,strlen($matchsstr)-1);
}
echo $matchsstr;
?>];	
var color = [<?php 
$colorsstr = '';
$inidex = 0;
foreach ($colors as $c=>$v){
	//if($inidex ==1) {
	//	$colorsstr  .= ("'',");
	//}
	$colorsstr  .= ("'".$v."',");
	$inidex ++;
} 
if($colorsstr){
	$colorsstr = substr($colorsstr,0,strlen($colorsstr)-1);
}
echo $colorsstr;
?>];
	var mt_id = <?php echo $mt_id; ?>;
	var rd_id = <?php echo $rd_id; ?>;
	var mt_sts = '<?php echo $mt_sts; ?>';
	var mt_round = <?php echo $mt_round; ?>;
	var maxRound = <?php echo $maxRound; ?>;
	var index = '<?php echo $index; ?>';
	var pl_id = '<?php echo $pl_id; ?>';
	var tm_id = '<?php echo $tm_id; ?>';
	var leadertop = 13;
	var pageno = 1;
	var pageset = 13;
	var teampagetotal = 0;
	var playerpagetotal = 0;
	getdata(rd_id);
    function getdata(rd,isloading,divobj,contentobj,status,func){
		
		   // console.log(rd);
			$.ajax({
                    url:'./lcd-data.php?time='+Date.now()+'&mt_id='+mt_id+'&rd_id='+rd_id+'&index=' + index,
                    dataType:"json",
                    success:function(res){
                        //console.log(res)
                        /*var score_new=res.split('<--split-->');
						
                        // $("#newhtml").html(res);
                        // var score_new = $("#newhtml .lf_scroll_box1").html();
						 $("#scoringlists").html(score_new[0]);
                         $("#scoringlistshbh").html(score_new[1]);
                         //loadswiper();*/
						$('#leftleader').html('');
						$('#con_scoring_content').html('');
						console.log(res);
						/*console.log(score_new[1]);*/
						loadholebyholetitle(res,index);
						loadleadertitle(res,index);
						loadleaderscore(res,index,true);
						/*loadholebyholetitle(res,parseInt(index)+1);
						loadleadertitle(res,parseInt(index)+1);
						loadleaderscore(res,parseInt(index)+1,true);*/
						startrefresh();
						//loadleaderscore(res);
						
						//showandhidetd(IsMobile());
					
						//console.log(page);
                    },
					complete:function(){
						if(func){
							func();
						}
						
						//initlocation();
						
					},
					fail:function(res){
						console.log(res);
					}
                })
		}
		
		function loadleadertitle(jsondata,ii){
			//console.log(color);
			var 
			    html = 	'  <div id="l'+ii+'" class="row leadertitle poppin" style="background-color:'+color[ii]+'">';	
				
				html += 	' <div class="w10" style="background-color:'+color[ii]+';color:#fff">POS</div>';
				html +=	'	<div class="w45" style="background-color:'+color[ii]+';color:#fff">'+ jsondata.title[ii] +'-TOP <font class="poppin">'+ leadertop +'</font></div>';
				html +=	'	<div class="w15" style="background-color:'+color[ii]+';color:#fff">Today</div>';
				html +=	'	<div class="w15"  style="background-color:'+color[ii]+';color:#fff">Thru</div>';
				html +=	'  <div class="w15" style="background-color:'+color[ii]+';color:#fff">Score</div>';
              // 	html +=	'	<div class="w15"  style="background-color:'+color[index-1]+';color:#fff">总杆数</div>';
					
				html += '</div>';
				
				
				
				$('#leftleader').html($('#leftleader').html()+html);
		}
		
		function loadleaderscore(jsondata,ii,isleader){
			//console.log(color);
			var holebyholehtml= '';
			var isteam = false;//(ii%2 == 0);
			var html = '';
			var rank = (isteam)?jsondata.teamrank:(jsondata.playerrank ?jsondata.playerrank:'');
			var strids = (isteam)?'t_':'p_';
			var cls_id = jsondata.cls_id;
			if(isteam) {
				teampagetotal = Math.ceil(rank.length /pageset) ;
				//if(isleader) { teampagetotal = 1 ;}
				console.log(teampagetotal);
			}
			else{
				playerpagetotal =  Math.ceil(rank.length /pageset) ;
				//if(isleader) { playerpagetotal = 1 ;}
				console.log(playerpagetotal);
			}
			
			holebyholehtml += '<div id="'+((isteam)?'t_c':'p_c')+ii+'" style="overflow:scroll;height:855px;">';
			html += '<div id="'+((isteam)?'lt_c':'lp_c')+ii+'" style="height:'+ ((isleader?leadertop:pageset)*61) +'px;">';
			for(var iindex  in rank){
				var pageindex =Math.ceil((parseInt(iindex) +1) / pageset);
				var pageorder = (parseInt(iindex) +1) % pageset;
				var i = rank[iindex].id;
				var names = '';
				var todaystr = '';
				var thru = '';
				var toparstr = '';
				var datathru = '';   
				var topar = '';
				var today = '';
				var todayscore = '';
				if(!isteam) {
					datathru = (jsondata.holeScore && jsondata.holeScore.thru && jsondata.holeScore.thru[i])?jsondata.holeScore.thru[i]:0;
					today =	(jsondata.score && 	jsondata.score.to_par && jsondata.score.to_par[i] && 	jsondata.score.to_par[i][mt_round])?jsondata.score.to_par[i][mt_round]:'';
					todayscore =	(jsondata.score && 	jsondata.score.rd_score && jsondata.score.rd_score[i] && 	jsondata.score.rd_score[i][mt_round])?jsondata.score.rd_score[i][mt_round]:'';
					topar =(jsondata.topar &&  jsondata.topar[i]!=='')?jsondata.topar[i]:'';
					var starthole = (jsondata.start_hole && jsondata.start_hole.gp_start_hole  && jsondata.start_hole.gp_start_hole[i])?jsondata.start_hole.gp_start_hole[i]:'';
					var starttime = (jsondata.start_hole && jsondata.start_hole.gp_start_time && jsondata.start_hole.gp_start_time[i])?jsondata.start_hole.gp_start_time[i].substr(10,6):'';
				
					var playerName = (jsondata.players && jsondata.players.playerName &&  jsondata.players.playerName[i])? jsondata.players.playerName[i]:'';
					var playerSex = (jsondata.players && jsondata.players.playerSex &&  jsondata.players.playerSex[i])? jsondata.players.playerSex[i]:'';
					
					var playerEnName = (jsondata.players && jsondata.players.playerEnName &&  jsondata.players.playerEnName[i])? jsondata.players.playerEnName[i]:'';
					var playerEnshortName = (jsondata.players && jsondata.players.playerEnshortName &&  jsondata.players.playerEnshortName[i])? jsondata.players.playerEnshortName[i]:'';
					if(playerEnshortName){
						names=  ' <div style="width:100%;display:flex;flex-direction:column;justify-content:start;"><div style="width:100%;text-align:left;">'+ playerEnshortName+'</div></div>';
					}
					else{
					names=  ' <div style="width:100%;display:flex;flex-direction:column;justify-content:start;"><div style="width:100%;text-align:left;">'+ playerName+'</div>'+((playerName !== playerEnName)?('<div style="font-size:14px;width:100%;text-align:left;" class="poppin">'+playerEnName+'</div>'):'')+'</div>';
					}
					if(datathru == 18 ){
						todaystr =  '<span '+((today<0)?'style="color:#e50049;"':'')+'>'+((todayscore)?todayscore:'-')+'</span>';
						if(rank[iindex].checked == 'C'){
							thru = '<font style="font-weight:bolder;color:'+color[index-1]+';">F</font>';
						}
						else{
							thru = '<font >F</font>';
						}
					}
					else{
						todaystr =  '<span '+((today<0)?'style="color:#e50049;"':'')+'>'+((today==='0') ? 'E' : ((today=='') ? '' : ((today>0) ? '+'+today: today)))+'</span>';
						if(datathru){
							thru = '<font >'+datathru + (starthole>=10?'*':'' ) +'</font>';
						}
						else{
							thru = '<font style="font-size:12px;font-weight:500;">'+starttime  + (starthole>=10?'*':'' ) +'</font>';
						}
					}
					toparstr = '<div class="topar '+((topar<0)?'undereven"':((topar===0)?'even"':((topar>0)?'pluseven"':'"')))+'>'+((topar===0) ? 'E' : ((topar==='') ? '' : ((topar>0) ? '+'+topar :topar)))+'</div>';
				}
				if(isteam) {
					datathru = (jsondata.teamScores && jsondata.teamScores[i] && jsondata.teamScores[i].team_thru)?jsondata.teamScores[i].team_thru:0;
					names=  ' <a href="#" onclick="gototeamdetail('+i+',\''+jsondata.title+'\',\''+rank[iindex].tm_name.split('-')[0]+'\')"><span style="font-weight:700;color:#333;">'+rank[iindex].tm_name.split('-')[0]+'</span></a>';
					today = (jsondata.teamscoretotal && jsondata.teamscoretotal.to_par && jsondata.teamscoretotal.to_par[i] &&  jsondata.teamscoretotal.to_par[i][mt_round])? jsondata.teamscoretotal.to_par[i][mt_round]:'';
					todayscore = (jsondata.teamscoretotal && jsondata.teamscoretotal.score && jsondata.teamscoretotal.score[i] && jsondata.teamscoretotal.score[i][mt_round])?jsondata.teamscoretotal.score[i][mt_round]:'';
					topar = (jsondata.teamscoretotal && jsondata.teamscoretotal.total_topar &&  jsondata.teamscoretotal.total_topar[i]!=='')? jsondata.teamscoretotal.total_topar[i]:'';
					total_score = (jsondata.teamscoretotal && jsondata.teamscoretotal.total_score &&  jsondata.teamscoretotal.total_score[i])? jsondata.teamscoretotal.total_score[i]:'';
					
					if(datathru == 18 ){
						todaystr =  '<span '+((today<0)?'style="color:#e50049;"':'')+'>'+((todayscore)?todayscore:'-')+'</span>';
						if(1==1){
							thru = '<font style="font-weight:bolder;color:'+color[index-1]+';">F</font>';
						}
						else{
							thru = '<font >F</font>';
						}
					}
					else{
						todaystr =  '<span '+((today<0)?'style="color:#e50049;"':'')+'>'+((today=='0') ? 'E' : ((today=='') ? '' : ((today>0) ? '+'+today : today)))+'</span>';
						if(datathru){
							thru = '<font >'+datathru+'</font>';
					}
						else{
							thru = '<font >-</font>';
					}
					}
					
					
						toparstr = '<div class="topar '+((topar<0)?'undereven"':((topar===0)?'even"':((topar>0)?'pluseven"':'"')))+'>'+((topar===0) ? 'E' : ((topar=='') ? '' : ((topar>0) ? '+'+topar :topar)))+'</div>';
				}
				if(isleader && iindex <leadertop || !isleader){
					
				html += '<div id="'+strids+i+'" class="row score " >';	
				html += ' <div class="w10 poppin" >'+(isteam?((rank[iindex].rank!=0 && rank[iindex].rank!=null)?rank[iindex].rank:'-'):((rank[iindex].rank!=0 && rank[iindex].rank!=null)?rank[iindex].rank:'-'))+'</div>';			
				html +=	'	<div class="w45 name" >'+ names+' </div>';
				html +=	'	<div class="w15 poppin" >'+todaystr+'</div>';
				html +=	'	<div class="w15 thru poppin"  >'+thru+'</div>';
				html +=	'  <div class="w15 poppin" >'+toparstr+'</div>';
              // 	html +=	'	<div class="w15"  style="background-color:'+color[index-1]+';color:#fff">总杆数</div>';	
				}
			  /**  holebyhole  **/
				holebyholehtml +=  '<div id="'+strids+pageindex+'_'+pageorder+'" class="row score holebyholescore" >';
			  
			
				
				if(isteam){  //团队
					holebyholehtml += 	' <div class="w10" >'+(isteam?((rank[iindex].rank!=0 && rank[iindex].rank!=null)?rank[iindex].rank:'-'):((rank[iindex].rank!=0 && rank[iindex].rank!=null)?rank[iindex].rank:'-'))+'</div>';
					holebyholehtml +=	'	<div class="w30" >'+ names +' </div>';
					holebyholehtml +=	'	<div class="w10" >'+toparstr+'</div>';
					holebyholehtml +=	'	<div class="w10" >'+thru+'</div>';	
					for(var r=1;r<=maxRound;r++){
						var teamroundtoday = (jsondata.teamscoretotal && jsondata.teamscoretotal.to_par && jsondata.teamscoretotal.to_par[i] &&  jsondata.teamscoretotal.to_par[i][r])? jsondata.teamscoretotal.to_par[i][r]:'';
						var teamroundtodayscore = (jsondata.teamscoretotal && jsondata.teamscoretotal.score && jsondata.teamscoretotal.score[i] && jsondata.teamscoretotal.score[i][r])?jsondata.teamscoretotal.score[i][r]:'';
						if(r == mt_round){
							holebyholehtml +=	'  <div class="w10" >'+  todaystr  +'</div>';
						}
						else{
							if(teamroundtodayscore){
								holebyholehtml +=	'  <div class="w10" ><span '+((teamroundtoday<0)?'style="color:#e50049;"':'')+'>'+teamroundtodayscore +'</span></div>';
							}
							else{
								holebyholehtml +=	' <div class="w10" ></div>';
							}
						}
					}
						holebyholehtml +=	'  <div class="w10" ><span '+((topar<0)?'style="color:#e50049;"':'')+'>'+total_score +'</span></div>';
				}
				else{   //个人
					holebyholehtml += 	' <div class="w5 poppin" >'+(isteam?((rank[iindex].rank!=0 && rank[iindex].rank!=null)?rank[iindex].rank:'-'):((rank[iindex].rank!=0 && rank[iindex].rank!=null)?rank[iindex].rank:'-'))+'</div>';
					holebyholehtml +=	'	<div class="w10 playernametitle" >'+ names +' </div>';
					holebyholehtml +=	'	<div class="w5 poppin" >'+toparstr+'</div>';
					holebyholehtml +=	'	<div class="w5 thru poppin" >'+thru+'</div>';	
					holebyholehtml +=	'	<div class="w5 poppin" >'+todaystr+'</div>';	
					var outtotal = 0;
					for(var holeindex =1;holeindex<=9;holeindex++){
						var holetopar = (jsondata.holeScore && jsondata.holeScore.topar &&  jsondata.holeScore.topar[i] && jsondata.holeScore.topar[i][holeindex])?jsondata.holeScore.topar[i][holeindex]:'';
						var holescore = (jsondata.holeScore && jsondata.holeScore.score &&  jsondata.holeScore.score[i] && jsondata.holeScore.score[i][holeindex])?jsondata.holeScore.score[i][holeindex]:'';
						holebyholehtml +=	'	<div class="w3-5 hole poppin" >'
						holebyholehtml+= '<div class="'+toparcolor_mobile(holetopar)+' poppin">'+holescore+'</div>';
						
						holebyholehtml +=' </div>';
						outtotal +=  parseInt(holescore?holescore:0);
						
					}
					holebyholehtml+= '<div class="w5 outin poppin">'+(outtotal?outtotal:'')+'</div>';
					
					var intotal = 0;
					for(var holeindex =10;holeindex<=18;holeindex++){
						var holetopar = (jsondata.holeScore && jsondata.holeScore.topar &&  jsondata.holeScore.topar[i] && jsondata.holeScore.topar[i][holeindex])?jsondata.holeScore.topar[i][holeindex]:'';
						var holescore = (jsondata.holeScore && jsondata.holeScore.score &&  jsondata.holeScore.score[i] && jsondata.holeScore.score[i][holeindex])?jsondata.holeScore.score[i][holeindex]:'';
						holebyholehtml +=	'	<div class="w3-5 hole poppin" >'
						holebyholehtml+= '<div class="'+toparcolor_mobile(holetopar)+' poppin">'+holescore+'</div>';
						
						holebyholehtml +=' </div>';
						intotal +=  parseInt(holescore?holescore:0);
					}
					holebyholehtml+= '<div class="w5 outin poppin">'+(intotal?intotal:'')+'</div>';
					var playertotals = 0;
					for(var r= 1 ;r<=maxRound;r++){
						var playertoday =	(jsondata.score && 	jsondata.score.to_par && jsondata.score.to_par[i] && 	jsondata.score.to_par[i][r])?jsondata.score.to_par[i][r]:'';
						var playertodayscore =	(jsondata.score && 	jsondata.score.rd_score && jsondata.score.rd_score[i] && 	jsondata.score.rd_score[i][r])?jsondata.score.rd_score[i][r]:'';
					
						if(r==mt_round){
							holebyholehtml +=	'  <div class="w5 round poppin" >'+todaystr+'</div>';
						}
						else{
							if(playertodayscore){
								holebyholehtml +=	'  <div class="w5 round poppin" ><span '+((playertoday<0)?'style="color:#e50049;"':'')+'>'+playertodayscore +'</span></div>';
							}
							else{
								holebyholehtml +=	' <div class="w5 round poppin" ></div>';
							}
						}
						playertotals += parseInt(playertodayscore?playertodayscore:0);
					}
					holebyholehtml +=	'  <div class="w6 total poppin" >'+(playertotals?playertotals:'')+'</div>';
					
					
					
				}
				
			 /**   holebyhole - end  **/
			 if(isleader && iindex <leadertop || !isleader){
				html += '</div>';
			 }
				holebyholehtml += '</div>';
				
				
				//console.log(html);
				}
				
				
				holebyholehtml += '</div>';
				html += '</div>';
				//console.log(html);
				//console.log(holebyholehtml);
				$('#leftleader').html($('#leftleader').html()+html);
				$('#con_scoring_content').html($('#con_scoring_content').html()+holebyholehtml);
		}
		
		function toparcolor_mobile(topar){
			var rstcolors = '';
			if (topar!==''){
				if (topar<=-2){
					rstcolors = 'mtwo';
				} else if (topar==-1){
					rstcolors = 'mone';
				} else if (topar==0){
					rstcolors = 'eng';
				} else if (topar==1){
					rstcolors = 'pone';
				} else if (topar>=2){
					rstcolors = 'ptwo';
				} else {
					rstcolors = 'eng';
				}
			} else {
				rstcolors = '';
			}
			return rstcolors;
		}
		
		function loadholebyholetitle(jsondata,ii){
			console.log(color);
			var cls_id = jsondata.cls_id;
				var isteam = false;// (ii%2 == 0);
				var html = '';
			    html += '<div id="hbht_'+ii+'" class="row leadertitle poppin '+(!isteam?'holebyholetitle':'')+'" style="background-color:'+color[index-1]+'">';	
				if(isteam){ //团队
				html += 	' <div class="w10" style="background-color:'+color[ii]+';color:#fff">POS</div>';
				html +=	'	<div class="w30" style="background-color:'+color[ii]+';color:#fff">'+ jsondata.title[ii]  +' </div>';
				html +=	'	<div class="w10" style="background-color:'+color[ii]+';color:#fff">Score</div>';
				html +=	'	<div class="w10"  style="background-color:'+color[ii]+';color:#fff">Thru</div>';
				for(var r= 1 ;r<=maxRound;r++){
					html +=	'  <div class="w10" style="background-color:'+color[ii]+';color:#fff">R'+r+'</div>';
				}
				html +=	'  <div class="w10" style="background-color:'+color[ii]+';color:#fff">Total</div>';
              // 	html +=	'	<div class="w15"  style="background-color:'+color[index-1]+';color:#fff">总杆数</div>';
				}
				else{ //个人holebyhole
				
					html += 	' <div class="w5" style="background-color:'+color[ii]+';color:#fff">POS</div>';
					html +=	'	<div  class="w10 playernametitle" style="background-color:'+color[ii]+';color:#fff">'+ jsondata.title[ii] +' </div>';
					html +=	'	<div class="w5" style="background-color:'+color[ii]+';color:#fff">Score</div>';
					html +=	'	<div class="w5"  style="background-color:'+color[ii]+';color:#fff">Thru</div>';
					html +=	'	<div class="w5"  style="background-color:'+color[ii]+';color:#fff">Today</div>';
					var pars = jsondata.pars;
				
					for(var holeindex =1;holeindex<=9;holeindex++){
						var holepar = (pars.par[cls_id] && pars.par[cls_id][holeindex-1])?pars.par[cls_id][holeindex-1]:'';
						html +=	'	<div class="w3-5 hole"  style="background-color:'+color[ii]+';color:#fff">'
						html+= '<div class="holeno">'+holeindex+'</div>';
						html+= '<div class="holepar">'+holepar+'</div>';
						html +=' </div>';
					
					}
					html+= '<div class="w5 hole" style="background-color:'+color[ii]+';color:#fff"><div class="holeno">OUT</div><div class="holepar">'+(pars.OUT[cls_id]?pars.OUT[cls_id]:'')+'</div></div>';
					
					var inpars = 0;
					for(var holeindex =10;holeindex<=18;holeindex++){
						var holepar = (pars.par[cls_id] && pars.par[cls_id][holeindex-1])?pars.par[cls_id][holeindex-1]:'';
						html +=	'	<div class="w3-5 hole"  style="background-color:'+color[ii]+';color:#fff">'
						html+= '<div class="holeno">'+holeindex+'</div>';
						html+= '<div class="holepar">'+holepar+'</div>';
						html +=' </div>';
						
					}
					html+= '<div class="w5 hole" style="background-color:'+color[ii]+';color:#fff"><div class="holeno">IN</div><div class="holepar">'+(pars.IN[cls_id]?pars.IN[cls_id]:'')+'</div></div>';
					
					for(var r= 1 ;r<=maxRound;r++){
						html +=	'  <div class="w5 round" style="background-color:'+color[ii]+';color:#fff">R'+r+'</div>';
					}
					html +=	'  <div class="w6 total" style="background-color:'+color[ii]+';color:#fff">Total</div>';
					
				}
				html += '</div>';
				$('#con_scoring_content').html($('#con_scoring_content').html()+html);
		}
		
		var refreshindex = 1;
		var refreshtimeobj = '';
		var refreshtime = 10  ;
		
		function startrefresh(){
			refreshindex=1;
			if(!refreshtimeobj){
					clearInterval(refreshtimeobj);
			
			var teampageno = 1;
			var playerpageno = 1;
			refreshtimeobj = setInterval(function(){
				if(refreshindex++ % refreshtime==0){
					refreshdata();
				}
				else{
					
				}
			},1000);
			}
		}
		var teampageno = 1;
		var playerpageno = 1;
		function refreshdata(){
			if(index %2 == 0  && 1==0){ //团队查看是否是最后一页
				if(teampageno<teampagetotal){ //跳到下一页
					teampageno++;
					scrolldiv( $('#t_c'+index),$('#t_'+teampageno+'_1'));
				}
				else{
					
					index++;
					
					if(index >4){index = 1;}
					/*playerpageno = 1;
					scrolldiv($('#con_scoring_content'), $('#hbht_'+index));*/
					//if(index >4){index = 1;}
					teampageno = 1;
					mt_id = (index<=2)?matchlists[0]:matchlists[1];
					getdata(rd_id,false,'','','',function(){
						//先滚动到下一个页面
						//删除之前的控件
						/*$('#hbht_'+(index<=2?3:1)).remove();
						$('#hbht_'+(index<=2?4:2)).remove();
						$('#t_c'+(index<=2?3:1)).remove();
						$('#l'+(index<=2?3:1)).remove();
						$('#l'+(index<=2?4:2)).remove();
						$('#lt_c'+(index<=2?3:1)).remove();
						$('#lp_c'+(index<=2?4:2)).remove();
						
						$('#p_c'+(index<=2?4:2)).remove();*/
						
					scrolldiv($('#con_scoring_content'), $('#hbht_'+index));
					scrolldiv( $('#t_c'+index),$('#t_'+teampageno+'_1'));
					scrolldiv($('#leftleader'), $('#l'+index));
						
						
					});
					return ;
				}
	
			}
			else if(index>=0){
				if(playerpageno<playerpagetotal){ //跳到下一页
					playerpageno++;
					scrolldiv( $('#p_c'+index),$('#p_'+playerpageno+'_1'));
				}
				else{
					index++;
					
					if(index >=6 && rd_id<=2){index = 0;}
					if(index >=2 && rd_id>2){index = 0;}
					playerpageno = 1;
					mt_id = (index<=2)?matchlists[0]:matchlists[1];
					getdata(rd_id,false,'','','',function(){
						//先滚动到下一个页面
						//删除之前的控件
						/*$('#hbht_'+(index<=2?3:1)).remove();
						$('#hbht_'+(index<=2?4:2)).remove();
						$('#t_c'+(index<=2?3:1)).remove();
						$('#l'+(index<=2?3:1)).remove();
						$('#l'+(index<=2?4:2)).remove();
						$('#lt_c'+(index<=2?3:1)).remove();
						$('#lp_c'+(index<=2?4:2)).remove();
						
						$('#p_c'+(index<=2?4:2)).remove();*/
						
					scrolldiv($('#con_scoring_content'), $('#hbht_'+index));
					scrolldiv( $('#t_c'+index),$('#t_'+playerpageno+'_1'));
					scrolldiv($('#leftleader'), $('#l'+index));
						
						
					});
					return ;
				}
			}
			
		}
		function scrolldiv(container,scrollTo){
			

			/*container.scrollTop( 
			scrollTo.offset().top - container.offset().top + container.scrollTop() 
			); */
			console.log(container);
			console.log(scrollTo);
			// Or you can animate the scrolling: 
			container.animate({ 
			scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() 
			},1500);
		}
</script>
	
<div  style="position:fixed;bottom:0;left:0;width:100%;display:none;justify-content: center; flex-direction:column;">
	<div id="bootom-top" style="text-align:centre;display:flex;justify-content: center; width:100%;" >
	
    <span style="width:100%;text-align:right;font-size:10px;color:#203466">技术支持  @斯科云科技
	
	</div>
</div>
</body>
</html>